#pragma once

#define DEFFNC(f) INT f (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);

DEFFNC(my_print)
DEFFNC(my_delay)
DEFFNC(my_load)
DEFFNC(my_include)
DEFFNC(my_getPlayer)
DEFFNC(my_getUnit)
DEFFNC(my_getMultiboard)
DEFFNC(my_toDouble)
DEFFNC(my_copyUnit)
DEFFNC(my_registerEvent)

#undef DEFFNC

VOID my_FinalizeStub(JSContext *cx, JSObject *obj);

static JSClass my_global_class =
{
	"Global", JSCLASS_GLOBAL_FLAGS,
	JS_PropertyStub,  JS_PropertyStub, JS_PropertyStub,  JS_PropertyStub,
	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,  my_FinalizeStub,
};

static JSFunctionSpec my_functions[] = {
	{"print",				my_print,				1},
	{"delay",				my_delay,				1},
	{"load",				my_load,				1},
	{"include",				my_include,				1},
	{"getPlayer",			my_getPlayer,			0},
	{"getUnit",				my_getUnit,				0},
	{"getMultiboard",		my_getMultiboard,		0},
	{"toDouble",			my_toDouble,			1},
	{"copyUnit",			my_copyUnit,			1},
	{"registerEvent",		my_registerEvent,		1},
};

enum {
	PRIVATE_PLAYER = 1,
	PRIVATE_UNIT = 2,
	PRIVATE_MULITBOARD = 3,
};

struct Private
{
	DWORD dwPrivateType;
};